"""
_*_ : utf-8 _*_ 
@Time: 2023/10/29 21:53
@Author: LWK
@File: 032_list操作
@Project: demo01
"""
list_var = ['h', 'l']
list_var.append('l')

print(list_var)

list_var.insert(1, 'e')
print(list_var)

list_var.extend(['o', ',', 'w', 'o', 'r', 'l', 'd'])
print(list_var)

city_list = ['京城', '上海']
city_list[1] = '申城'
print(city_list)

print(city_list.index('申城'))

city_input = input("请输入城市：")
if city_input in city_list:
    print('在呢~')
else:
    print('sorry, not in')

if city_input not in city_list:
    print('不在~')
    b = input('是否增加？ 「y/n」')
    if b == 'y':
        city_list.append(city_input)
else:
    print('在呢')

print(city_list)

print('%s将删除' % city_list[0])
# 删除指定下标 city_list.pop(0)
del city_list[0]
print(city_list)

# 删除最后一个
c = city_list.pop()
print('%s也通过pop删除了' % c)
print(city_list)

num_list = [0, 1, 1, 2]
print(num_list)
# remove删除指定元素）
num_list.remove(1)
print(num_list)
